package services;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import DataAccess.DeviceDA;
import DataAccess.NguoiDungDA;
import DataAccess.NodeThaoLuanDA;

import pojo.DevicePOJO;
import pojo.NguoiDungPOJO;
import pojo.NodeThaoLuanPOJO;
import pojo.PairValue;
import util.ClientSender;
import util.Common;

/**
 * Servlet implementation class SendAllServlet
 */
@WebServlet("/SendAllServlet")
public class SendAllServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public SendAllServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
			IOException {
		int idNhom=1;
		ArrayList<PairValue> params=new ArrayList<PairValue>();
		params.add(new PairValue(Protocol.CMD, Protocol.TAO_CAY));
		params.add(new PairValue(Protocol.ID_CAY, 2+""));
		params.add(new PairValue(Protocol.NGUOI_GUI, 1+""));
		try {
			ClientSender.sendToGroup(idNhom, params);
		} catch (Exception e) {
		
			e.printStackTrace();
		}
	}

}
